﻿#include "FITKPHengLEIViscousTypeManager.h"
#include "FITK_Kernel/FITKCore/FITKEnumTransformer.hpp"
#include "FITKPHengLEIViscousType.h"

namespace Interface
{
	FITKPHengLEIViscousTypeManager::FITKPHengLEIViscousTypeManager()
    {
        this->initViscousTypes();
    }

	FITKPHengLEIViscousTypeManager::~FITKPHengLEIViscousTypeManager()
    {

    }

	QStringList FITKPHengLEIViscousTypeManager::filterTurbence()
	{
		QStringList listType;
		//求解器遍历
		for (QList<FITKPHengLEIViscousTypeInfo>::iterator iter = _viscousTypes.begin(); iter != _viscousTypes.end(); ++iter)
		{

			listType.append(iter->_viscousTypeName);
		}
		return listType;
	}


	FITKPHengLEIViscousTypeInfo FITKPHengLEIViscousTypeManager::getViscousTypeInfoByName(QString inFLowTypeName)
	{

		for (QList<FITKPHengLEIViscousTypeInfo>::iterator iter = _viscousTypes.begin(); iter != _viscousTypes.end(); ++iter)
		{
			if (iter->_viscousTypeName == inFLowTypeName)
				return *iter;
		}
		return FITKPHengLEIViscousTypeInfo();
	}

	void FITKPHengLEIViscousTypeManager::initViscousTypes()
    {
        //注册Turbulent1eq
		FITKPHengLEIViscousTypeInfo turbulent1;
		turbulent1._viscousTypeName = "Turbulent1eq";
		turbulent1._enableType = { FITKPHengLEIAbsSolver::PLHypersonic,FITKPHengLEIAbsSolver::PLSubsonic,FITKPHengLEIAbsSolver::PLSupersonic,FITKPHengLEIAbsSolver::PLTransonic};
		turbulent1._createFuns = [&]{return new Turbulent1eq(); };
		_viscousTypes.append(turbulent1);

        //注册Turbulent2eq
		FITKPHengLEIViscousTypeInfo turbulent2;
		turbulent2._viscousTypeName = "Turbulent2eq";
		turbulent2._enableType = { FITKPHengLEIAbsSolver::PLHypersonic,FITKPHengLEIAbsSolver::PLSubsonic,FITKPHengLEIAbsSolver::PLSupersonic,FITKPHengLEIAbsSolver::PLTransonic };
		turbulent2._createFuns = [&]() {return new Turbulent2eq(); };
        _viscousTypes.append(turbulent2);

		//注册Euler
		FITKPHengLEIViscousTypeInfo euler;
		euler._viscousTypeName = "Euler";
		euler._enableType = { FITKPHengLEIAbsSolver::PLHypersonic,FITKPHengLEIAbsSolver::PLSubsonic,FITKPHengLEIAbsSolver::PLSupersonic,FITKPHengLEIAbsSolver::PLTransonic };
		euler._createFuns = [&]() {return new Euler(); };
		_viscousTypes.append(euler);

		//注册Laminar
		FITKPHengLEIViscousTypeInfo laminar;
		laminar._viscousTypeName = "Laminar";
		laminar._enableType = { FITKPHengLEIAbsSolver::PLHypersonic,FITKPHengLEIAbsSolver::PLSubsonic,FITKPHengLEIAbsSolver::PLSupersonic,FITKPHengLEIAbsSolver::PLTransonic };
		laminar._createFuns = [&]() {return new Laminar(); };
		_viscousTypes.append(laminar);
    }
}




